#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#define MAX ((10000))

char selector[MAX+1] = {0};
int primes[MAX];
int pcount;

void select() {
  selector[0] = 1;
  selector[1] = 1;
  selector[2] = 0;
  
  pcount = 0;
  
  int i;
  int j;
  int t;
  for(i=2;i<=MAX;++i) {
    // save prime
    if(selector[i]==0) {
      primes[pcount] = i;
      ++pcount;
    }
    // refresh selector
    j=2;
    while(t=i*j, t<=MAX) {
      selector[t] = 1;
      ++j;
    }
  }
}

// Count the number of Consecutive Prime sequences
int ccp(int num) {
  scount=0; // sequence count 
  int flim=0, count=1, sum=2; // front limit, count, sum
  
  // find max count
  while(sum<num) {
    sum += primes[flim+count];
    ++count;
  }
  
  while(true) {
    // count == 1
    if(count==1 && primes[flim]==num) {
      ++scount;
      break;
    }
    // count == 2
    if(count==2) {
      if(primes[flim]+primes[++flim]==num) {
        ++scount;
      }
      if(primes[++flim])
    


int main() {
  // select primes
  select();
  int i;
  for(i=0;i<20;++i) printf("%d\n", primes[i]);
  system("pause");
  return 0;
}
